<!DOCTYPE html>
<html>
<head>
    <title>库房详情</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div>
        <table id="jqGrid"></table>
    </div>
</div>
<script>
    var code = getQueryString("code")
    console.log(code)
    $(function () {
        $("#jqGrid").Grid({
            url: '../sparestorepos/list?spareCode='+code,
            colModel: [
                {label: '库房', name: 'storeName', index: 'INT_STORE','width':180},
                {label: '货位', name: 'postion', index: 'CARGO_LOCATION'},
                {label: '备件名称', name: 'spareName', index: 'NAME'},
                {label: '系统编码', name: 'spareCode', index: 'PART_CODE'},
                {label: '库存数量', name: 'storeNum', index: 'STOCK_NUM'},
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true}
            ]
        });
    });

    let vm = new Vue({
        el: '#rrapp',
        data: {
            q: {
                partCode: ''
            }
        },
        methods: {
            query: function () {
                vm.reload();
            },
            reload: function (event) {
                let page = $("#jqGrid").jqGrid('getGridParam', 'page');
                $("#jqGrid").jqGrid('setGridParam', {
                    postData: {'partCode': vm.q.partCode},
                    page: page
                }).trigger("reloadGrid");
            },
            reloadSearch: function () {
                vm.q = {
                    partCode: ''
                };
                vm.reload();
            }
        }
    });
</script>
</body>
</html>
